@import (reference) "~ui/styles/variables";

.docTableBar {
  margin: 5px 5px 0;
}

/**
 * 1. Stack content vertically so the table can scroll when its constrained by a fixed container height.
 */
doc-table {
  overflow: auto;
  flex: 1 1 100%;
  flex-direction: column; /* 1 */

  .discover-table-datafield {
    white-space: pre-wrap;

    // break-word is what we really want but it hasn't been added to the standard and adopted by all browsers yet,
    // so we provide break-all as a fallback
    word-break: break-all;
    word-break: break-word;
  }

  .discover-table-sourcefield {
    word-break: break-all;
    word-break: break-word;
  }

  .discover-table-row {
    td {
      position: relative;

      .table-cell-filter {
        position: absolute;
        white-space: nowrap;
        right: 0;
      }

      &:hover {
        .docTableRowFilterButton {
          opacity: 1;
        }
      }
    }
  }

  .discover-table-row--highlight {
    td,
    .docTableRowFilterButton {
      background-color: #E2F1F6;
    }
  }

  .loading {
    opacity: @loading-opacity;
  }

  .spinner {
    position: absolute;
    top: 40%;
    left: 0;
    right: 0;
    z-index: 20;
    opacity: @loading-opacity;
  }
}

/**
 * 1. Align icon with text in cell.
 * 2. Use opacity to make this element accessible to screen readers and keyboard.
 * 3. Show on focus to enable keyboard accessibility.
 */
.docTableRowFilterButton {
  appearance: none;
  background-color: @panel-bg;
  border: none;
  padding: 0 3px;
  font-size: 14px;
  line-height: 1; /* 1 */
  display: inline-block;
  opacity: 0; /* 2 */

  &:focus {
    opacity: 1; /* 3 */
  }
}

.docTableHeaderButton {
  border: none;
  background: none;
  padding: 0;
}
